package com.wd.live.module_wide.viewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope


import com.wd.live.module_base.bean.FindLiveListBean
import com.wd.live.module_base.bean.FindLiveTypeList

import com.wd.live.module_base.ui.BaseResult
import com.wd.module_base.net.HttpUtils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch

/**
 * 作者:
 * 时间:2024/5/22
 * 描述:
 */
class WideViewModel :ViewModel(){
    val dataFindLiveList=MutableLiveData<BaseResult<List<FindLiveListBean>>>()
        fun getFindLiveList(liveType:Int, page:Int, size:Int) {
        viewModelScope.launch(Dispatchers.IO) {
            var  result = HttpUtils.apiService.getFindLiveList(liveType, page, size)
            if (result.status =="0000"){
                dataFindLiveList.postValue(result)
            }
        }
    }

    val dataFindtypeList=MutableLiveData<BaseResult<List<FindLiveTypeList>>>()
    fun getFindLiveTypeList(){
        viewModelScope.launch(Dispatchers.IO){
            val findLiveTypeList = HttpUtils.apiService.getFindLiveTypeList()
            if (findLiveTypeList.status=="0000"){
                dataFindtypeList.postValue(findLiveTypeList)
            }
        }
    }

}